import { createRouter, createWebHashHistory } from "vue-router";
const router = createRouter({
    history: createWebHashHistory(),
    routes: [
        {
            path: '/',
            name: '/',
            redirect: '/fstpage',
        },
        {
            path: '/login',
            name: 'login',
            component: () => import('../view/login.vue'),
            meta: {
                title: '登陆',
                showInAside: false,
                showInHeader: false
            }
        },
        {
            path: '/statics',
            name: 'statics',
            component: () => import('../view/statics.vue'),
            meta: {
                title: '系统首页',
                showInAside: true,
                showInHeader: true
            }
        },
        {
            path: '/fstpage',
            name: 'fstpage',
            component: () => import('../view/fstpage.vue'),
            meta: {
                title: '扉页',
                showInAside: false,
                showInHeader: false
            }
        },
        {
            path: '/main',
            name: 'main',
            component: () => import('../view/main.vue'),
            meta: {
                title: '运营中心登陆',
                showInAside: true,
                showInHeader: true
            }
        },
        {
            path: '/plotmap',
            name: 'plotmap',
            component: () => import('../view/map/plotmap.vue'),
            meta: {
                title: '普查小区图',
                showInAside: true,
                showInHeader: true,
                showfooter: true
            }
        },
        {
            path: '/jzwmap',
            name: 'jzwmap',
            component: () => import('../view/map/jzwmap.vue'),
            meta: {
                title: '建筑物地图',
                showInAside: true,
                showInHeader: true,
                showfooter: true
            }
        },
        {
            path: '/qhmap',
            name: 'qhmap',
            component: () => import('../view/map/qhmap.vue'),
            meta: {
                title: '区划地图',
                showInAside: true,
                showInHeader: true,
                showfooter: true
            }
        },
        {
            path: '/drawResList',
            name: 'drawResList',
            component: () => import('../view/map/drawResList.vue'),
            meta: {
                title: '绘制结果',
                showInAside: true,
                showInHeader: true
            }
        },
        {
            path: '/changePWD',
            name: 'changePWD',
            component: () => import('../view/system/changePWD.vue'),
            meta: {
                title: '修改密码',
                showInAside: true,
                showInHeader: true
            }
        },
        {
            path: '/userList',
            name: 'userList',
            component: () => import('../view/system/userList.vue'),
            meta: {
                title: '用户列表',
                showInAside: true,
                showInHeader: true
            }
        },
        {
            path: '/village',
            name: 'village',
            component: () => import('../view/xzmap/village.vue'),
            meta: {
                title: '乡(村)镇定位',
                showInAside: true,
                showInHeader: true
            },
            children: [
                {
                    path: '/xzmap',
                    name: 'xzmap',
                    component: () => import('../view/xzmap/xzmap.vue'),
                    meta: {
                        title: '乡(村)镇定位'
                    },
                }
            ]
        },
        {
            path: '/cwh',
            name: 'cwh',
            component: () => import('../view/xzmap/cwh.vue'),
            meta:{
                title: '普查区(村居委会)',
                showInAside: true,
                showInHeader: true,
                showfooter: true
            },
        },
        {
            path: '/xzpcxq',
            name: 'xzpcxq',
            component: () => import('../view/xzmap/pcxiaoqu.vue'),
            meta:{
                title: '普查小区',
                showInAside: true,
                showInHeader: true,
                showfooter: true
            },
        },
        {
            path: '/jzw',
            name: 'jzw',
            component: () => import('../view/xzmap/jzw.vue'),
            meta:{
                title: '建筑物',
                showInAside: true,
                showInHeader: true,
                showfooter: true
            },
        },
        {
            path: '/chart',
            name: 'chart',
            component: () => import('../view/charts/charts.vue'),
            meta:{
                title: '图表',
                showInAside: false,
                showInHeader: false
            },
        },
        {
            path: '/sschart',
            name: 'sschart',
            component: () => import('../view/charts/sschart.vue'),
            meta:{
                title: '图表',
                showInAside: false,
                showInHeader: false
            },
        },
        {
            path: '/workman',
            name: 'workman',
            component: () => import('../view/datamaintain/workman.vue'),
            meta:{
                title: '人口数据',
                showInAside: true,
                showInHeader: true
            },
        },
        {
            path: '/gdpmain',
            name: 'gdpmain',
            component: () => import('../view/datamaintain/GDPmain.vue'),
            meta:{
                title: 'GDP数据',
                showInAside: true,
                showInHeader: true
            },
        },
        {
            path: '/areamain',
            name: 'areamain',
            component: () => import('../view/area/areamain.vue'),
            meta:{
                title: '区划管理',
                showInAside: true,
                showInHeader: true
            },
        },
        {
            path: '/newarea',
            name: 'newarea',
            component: () => import('../view/area/newarea.vue'),
            meta:{
                title: '最新区划',
                showInAside: true,
                showInHeader: true
            },
        },
        {
            path: '/download',
            name: 'download',
            component: () => import('../view/template/download.vue'),
            meta:{
                title: '模板下载',
                showInAside: true,
                showInHeader: true
            },
        },
        {
            path: '/drawresult',
            name: 'drawresult',
            component: () => import('../view/xzmap/drawresult.vue'),
            meta:{
                title: '绘制成果',
                showInAside: true,
                showInHeader: true,
                showfooter:true
            },
        },
        {
            path:'/expmap',
            name: 'expmap',
            component: () => import('../view/exportmap/expmap.vue'),
            meta:{
                title: '导出数据',
                showInAside: false,
                showInHeader: false
            }
        },
        {
            path: '/transer',
            name: 'transer',
            component: () => import('../view/xzmap/transer.vue'),
            meta:{
                title: '区划转移管理',
                showInAside: true,
                showInHeader: true
            },
        }
    ]
});

// router.beforeEach((to, from, next) => {
//     // 判断有没有登录login_ggzx
//     const user = localStorage.getItem("token");
//     if (to.path !== '/login' && !user) {
//         if (to.path === '/login_ggzx') {
//             next();
//         } else {
//             next('/login');
//         }
//     }
//     else {
//         next();
//     }
// });
export default router;